﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using 抽象工厂模式.Models;

namespace 抽象工厂模式.Factory
{
    /// <summary>
    /// 工厂接口，创建访问User表和Department表的对象
    /// </summary>
    interface IFactory
    {
        IUser CreateUser();
        IDepartment CreateDepartment();
    }

    class SqlFactory : IFactory
    {
        public IUser CreateUser()
        {
            return new sqlUser();
        }
        public IDepartment CreateDepartment()
        {
            return new sqlDepartment();
        }
    }

    class AccessFactory : IFactory
    {
        public IUser CreateUser()
        {
            return new AccessUser();
        }
        public IDepartment CreateDepartment()
        {
            return new AccessDepartment();
        }
    }
}
